using System;
using UnityEngine;
using UnityEngine.UI;

public class ConsentKR : MonoBehaviour
{
	public void Initialize(BMConsentSetting setting)
	{
		this.termsOfServiceToggle.isOn = false;
		this.protectionPolicyToggle.isOn = false;
		this.termsOfServicesLabel.text = string.Format(this.termsOfServicesLabel.text, new object[]
		{
			setting.companyDisplayName,
			setting.privacyPolicyURL,
			setting.emailAddressForCRM,
			setting.emailAddressForCRM
		});
	}

	public void Show()
	{
		base.gameObject.SetActive(true);
	}

	public void Hide()
	{
		base.gameObject.SetActive(false);
	}

	public void OnClickTermsOfServiceToggle()
	{
		this.CheckToggleStatus();
	}

	public void OnClickProtectionPolicyToggle()
	{
		this.CheckToggleStatus();
	}

	public void OnClickStartPlayingButton()
	{
		if (this.termsOfServiceToggle.isOn && this.protectionPolicyToggle.isOn)
		{
			PlayerPrefs.SetInt("BM_TermsAgree", 1);
			PlayerPrefs.Save();
			if (this.OnDidClickStartPlaying != null)
			{
				this.OnDidClickStartPlaying();
			}
		}
	}

	private void CheckToggleStatus()
	{
		bool flag = this.termsOfServiceToggle.isOn && this.protectionPolicyToggle.isOn;
		this.startButtonImage.sprite = ((!flag) ? this.buttonSprites[0] : this.buttonSprites[1]);
	}

	public Action OnDidClickStartPlaying;

	[SerializeField]
	private Toggle termsOfServiceToggle;

	[SerializeField]
	private Toggle protectionPolicyToggle;

	[SerializeField]
	private Text termsOfServicesLabel;

	[SerializeField]
	private Image startButtonImage;

	[SerializeField]
	private Sprite[] buttonSprites;
}
